<!--
 * @Descripttion: 获取所有字段类型
 * @version: 
 * @Author: 淏
 * @Date: 2023-11-23 21:24:05
 * @LastEditors: 淏
 * @LastEditTime: 2023-11-24 14:15:36
-->
<template>
  <el-select
    ref="selectColumnType"
    v-model="value"
    placeholder="请选择字段类型"
    size="mini"
    :popper-append-to-body="false"
  >
    <el-option
      v-for="item in options"
      :key="item.value"
      :label="item.label"
      :value="item.value"
    ></el-option>
  </el-select>
</template>

<script>
  import { queryAll_columnType } from '@/api/index.js'
  export default {
    // 组件名称
    name: 'selectColumnType',
    // 组件参数 接收来自父组件的数据
    props: {},
    // 局部注册的组件
    components: {},
    // 组件状态值
    data() {
      return {
        options: [],
        value: '',
      }
    },
    // 计算属性
    computed: {},
    // 侦听器
    watch: {
      value(value) {
        this.$emit('getColumnType', value)
      },
    },
    // 组件方法
    methods: {
      getData() {
        queryAll_columnType().then((res) => {
          this.options = res.data.map((element) => {
            return {
              value: element,
              label: element,
            }
          })
        })
      },
    },
    created() {},
    mounted() {
      this.getData()
    },
  }
</script>

<style scoped></style>
